import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/third_party_user_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/third_party_user_train_record_entity.dart';


ThirdPartyUserEntity $ThirdPartyUserEntityFromJson(Map<String, dynamic> json) {
  final ThirdPartyUserEntity thirdPartyUserEntity = ThirdPartyUserEntity();
  final int? age = jsonConvert.convert<int>(json['age']);
  if (age != null) {
    thirdPartyUserEntity.age = age;
  }
  final String? blackReason = jsonConvert.convert<String>(json['blackReason']);
  if (blackReason != null) {
    thirdPartyUserEntity.blackReason = blackReason;
  }
  final String? certificateBeginDate = jsonConvert.convert<String>(json['certificateBeginDate']);
  if (certificateBeginDate != null) {
    thirdPartyUserEntity.certificateBeginDate = certificateBeginDate;
  }
  final String? certificateEndDate = jsonConvert.convert<String>(json['certificateEndDate']);
  if (certificateEndDate != null) {
    thirdPartyUserEntity.certificateEndDate = certificateEndDate;
  }
  final String? certificateLevel = jsonConvert.convert<String>(json['certificateLevel']);
  if (certificateLevel != null) {
    thirdPartyUserEntity.certificateLevel = certificateLevel;
  }
  final String? certificateName = jsonConvert.convert<String>(json['certificateName']);
  if (certificateName != null) {
    thirdPartyUserEntity.certificateName = certificateName;
  }
  final String? certificateNum = jsonConvert.convert<String>(json['certificateNum']);
  if (certificateNum != null) {
    thirdPartyUserEntity.certificateNum = certificateNum;
  }
  final List<ThirdPartyUserTrainRecordEntity>? children = (json['children'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<ThirdPartyUserTrainRecordEntity>(e) as ThirdPartyUserTrainRecordEntity).toList();
  if (children != null) {
    thirdPartyUserEntity.children = children;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    thirdPartyUserEntity.companyCode = companyCode;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    thirdPartyUserEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    thirdPartyUserEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    thirdPartyUserEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    thirdPartyUserEntity.deleted = deleted;
  }
  final int? highRisk = jsonConvert.convert<int>(json['highRisk']);
  if (highRisk != null) {
    thirdPartyUserEntity.highRisk = highRisk;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    thirdPartyUserEntity.id = id;
  }
  final String? idCard = jsonConvert.convert<String>(json['idCard']);
  if (idCard != null) {
    thirdPartyUserEntity.idCard = idCard;
  }
  final String? passRate = jsonConvert.convert<String>(json['passRate']);
  if (passRate != null) {
    thirdPartyUserEntity.passRate = passRate;
  }
  final String? phone = jsonConvert.convert<String>(json['phone']);
  if (phone != null) {
    thirdPartyUserEntity.phone = phone;
  }
  final String? position = jsonConvert.convert<String>(json['position']);
  if (position != null) {
    thirdPartyUserEntity.position = position;
  }
  final String? thirdPartyId = jsonConvert.convert<String>(json['thirdPartyId']);
  if (thirdPartyId != null) {
    thirdPartyUserEntity.thirdPartyId = thirdPartyId;
  }
  final String? thirdPartyName = jsonConvert.convert<String>(json['thirdPartyName']);
  if (thirdPartyName != null) {
    thirdPartyUserEntity.thirdPartyName = thirdPartyName;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    thirdPartyUserEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    thirdPartyUserEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    thirdPartyUserEntity.updateDate = updateDate;
  }
  final String? userImageUrl = jsonConvert.convert<String>(json['userImageUrl']);
  if (userImageUrl != null) {
    thirdPartyUserEntity.userImageUrl = userImageUrl;
  }
  final String? userName = jsonConvert.convert<String>(json['userName']);
  if (userName != null) {
    thirdPartyUserEntity.userName = userName;
  }
  final String? userStatus = jsonConvert.convert<String>(json['userStatus']);
  if (userStatus != null) {
    thirdPartyUserEntity.userStatus = userStatus;
  }
  return thirdPartyUserEntity;
}

Map<String, dynamic> $ThirdPartyUserEntityToJson(ThirdPartyUserEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['age'] = entity.age;
  data['blackReason'] = entity.blackReason;
  data['certificateBeginDate'] = entity.certificateBeginDate;
  data['certificateEndDate'] = entity.certificateEndDate;
  data['certificateLevel'] = entity.certificateLevel;
  data['certificateName'] = entity.certificateName;
  data['certificateNum'] = entity.certificateNum;
  data['children'] = entity.children?.map((v) => v.toJson()).toList();
  data['companyCode'] = entity.companyCode;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['highRisk'] = entity.highRisk;
  data['id'] = entity.id;
  data['idCard'] = entity.idCard;
  data['passRate'] = entity.passRate;
  data['phone'] = entity.phone;
  data['position'] = entity.position;
  data['thirdPartyId'] = entity.thirdPartyId;
  data['thirdPartyName'] = entity.thirdPartyName;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  data['userImageUrl'] = entity.userImageUrl;
  data['userName'] = entity.userName;
  data['userStatus'] = entity.userStatus;
  return data;
}

extension ThirdPartyUserEntityExtension on ThirdPartyUserEntity {
  ThirdPartyUserEntity copyWith({
    int? age,
    String? blackReason,
    String? certificateBeginDate,
    String? certificateEndDate,
    String? certificateLevel,
    String? certificateName,
    String? certificateNum,
    List<ThirdPartyUserTrainRecordEntity>? children,
    String? companyCode,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    int? highRisk,
    String? id,
    String? idCard,
    String? passRate,
    String? phone,
    String? position,
    String? thirdPartyId,
    String? thirdPartyName,
    String? updateBy,
    String? updateById,
    String? updateDate,
    String? userImageUrl,
    String? userName,
    String? userStatus,
  }) {
    return ThirdPartyUserEntity()
      ..age = age ?? this.age
      ..blackReason = blackReason ?? this.blackReason
      ..certificateBeginDate = certificateBeginDate ?? this.certificateBeginDate
      ..certificateEndDate = certificateEndDate ?? this.certificateEndDate
      ..certificateLevel = certificateLevel ?? this.certificateLevel
      ..certificateName = certificateName ?? this.certificateName
      ..certificateNum = certificateNum ?? this.certificateNum
      ..children = children ?? this.children
      ..companyCode = companyCode ?? this.companyCode
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..highRisk = highRisk ?? this.highRisk
      ..id = id ?? this.id
      ..idCard = idCard ?? this.idCard
      ..passRate = passRate ?? this.passRate
      ..phone = phone ?? this.phone
      ..position = position ?? this.position
      ..thirdPartyId = thirdPartyId ?? this.thirdPartyId
      ..thirdPartyName = thirdPartyName ?? this.thirdPartyName
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate
      ..userImageUrl = userImageUrl ?? this.userImageUrl
      ..userName = userName ?? this.userName
      ..userStatus = userStatus ?? this.userStatus;
  }
}
